﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Yto.Common.Dependency
{
    public class DisposeWapperObj<T> : IDisposeWapperObj<T>
    {
        private readonly ICtnResolver _ctnResolver;

        public DisposeWapperObj(ICtnResolver ctnResolver,T obj)
        {
            _ctnResolver = ctnResolver;
            WapperObj = obj;
        }

        public T WapperObj { get; private set; }

        public void Dispose()
        {
            _ctnResolver.Realse(WapperObj);
        }
    }

    public class DisposeWapperObj : DisposeWapperObj<object>, IDisposeWapperObj
    {
        public DisposeWapperObj(ICtnResolver ctnResolver,object obj)
            : base(ctnResolver, obj) { }
    }
}
